
keep if  ( index>=-16 & index<=24 ) & sentDOL==1 & ivsample==1

capture frame drop results
frame create results str10 outcomevar evicted notevicted time

foreach var of varlist earn emply {

reg `var' evictionorder qdum2-qdum41 evictXq2-evictXq41 i.courttime i.courtq 
		
*Calculate omitted group baseline mean
sum `var' if evictionorder==0 & index==-16  & e(sample)==1
local basemean=r(mean)
		
* adding period 1 (first) estimates
local rel_q=1-17
local qplot=`rel_q' 
local noevictplot= `basemean'
local evictplot=`basemean'+ _b[evictionorder] 
frame post results ("`var'")  (`evictplot') (`noevictplot') (`qplot')
		
foreach num of numlist 2(1)41 {
			local rel_q=`num'-17
			local qplot=`rel_q' 
			local noevictplot= `basemean'+_b[qdum`num']
			local evictplot=`basemean'+ _b[evictionorder]+_b[qdum`num']+_b[evictXq`num'] 
			frame post results ("`var'")  (`evictplot') (`noevictplot') (`qplot')
}
		
}

frame results: save  ${Inputs}\NY_labor_eventstudy, replace
